package com.linkhub.oms.admin.common.enums;

import cn.dev33.satoken.exception.NotLoginException;
import com.linkhub.oms.common.enums.ResponseCodeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description: sa登录态异常类型枚举
 * @Author: echo
 * @Date: 2024/3/7 21:41
 * @Version: 1.0
 */
@Getter
@AllArgsConstructor
public enum SaLoginExTypeEnum {

    BE_REPLACED(NotLoginException.BE_REPLACED, ResponseCodeEnum.BE_REPLACED),
    TOKEN_TIMEOUT(NotLoginException.TOKEN_TIMEOUT, ResponseCodeEnum.LOGIN_TIMEOUT),
    NOT_LOGIN("", ResponseCodeEnum.NOT_LOGIN),

    ;
    private final String type;
    private final ResponseCodeEnum resultCode;

    public static ResponseCodeEnum convertResponseCode(String saLoginType) {
        if (BE_REPLACED.getType().equals(saLoginType)) {
            return BE_REPLACED.getResultCode();
        }
        if (TOKEN_TIMEOUT.getType().equals(saLoginType)) {
            return BE_REPLACED.getResultCode();
        }

        return NOT_LOGIN.getResultCode();

    }



}
